<link rel="stylesheet" href="../static/bootstrap/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../static/jBox/Skins/Metro/jbox.css" type="text/css">
<link rel="stylesheet" href="../static/dist/css/AdminLTE.min.css" type="text/css">
<link rel="stylesheet" href="../static/css/admin.css" type="text/css">
<link rel="stylesheet" href="../static/plugins/treeTable/jquery.treetable.css" type="text/css">
<link rel="stylesheet" href="../static/plugins/treeTable/jquery.treetable.theme.default.css" type="text/css">
<style>
    .ul_tree_display{
        display: none;
    }
    .tr_tree_display{
        display: none;
    }
    .table>tbody>tr>td{
        vertical-align: middle;
        font-size: 0.8em;
    }
</style>
<div class="tabs-panel">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <button type="button" class="btn btn-success depart-modal menu-show-btn" style="width: 100px;">添加菜单</button>
                    <!--<h3 class="box-title">Hover Data Table</h3>-->
                    <!-- add by lizenan 20180210 导航菜单同步功能 512 start -->
                    <button type="button" class="btn btn-success depart-modal menu-show-refresh" style="width: 100px;">菜单刷新</button>
                    <!-- add by lizenan 20180210 导航菜单同步功能 512 end -->
                </div>
                <!-- /.box-header -->
                <div class="box-body">
                    <table id="example2" class="table table-bordered table-hover">
                        <thead>
                        <tr>
                            <th class="">菜单名称</th>
                            <!--<th class="">应用</th>-->
                            <th class="">控制器</th>
                            <th class="">方法</th>
                            <th class="">排序</th>
                            <th class="">状态</th>
                            <th class="">修改</th>
                            <th class="">添加子菜单</th>
                            <!--<th class="">删除</th>-->
                        </tr>
                        </thead>
                        <tbody>
                        <?php if(!empty($data_list)){?>
                            <?php foreach ($data_list as $key => $val) {?>
                                <tr data-tt-id="<?= $val['id']?>" data-tt-parent-id="<?= $val['parent_id']?>" class="">
                                    <td class="" style="width: 250px;padding-left: 20px;">
                                        <?= $val['html']?>
                                        <?= $val['name']?>
                                    </td>
                                    <!--<td class="" style="width: 100px;"><?/*= $val['app']*/?></td>-->
                                    <td class="" style="width: 140px;"><?= $val['model']?></td>
                                    <td class="" style="width: 140px;"><?= $val['action']?></td>
                                    <td class="" style="width: 80px;"><?= $val['sort']?></td>
                                    <td class="" style="width: 80px;">
                                        <?php if($val['status'] == 1){?>
    
                                            显示
    
                                        <?php }else{?>
    
                                            隐藏
    
                                        <?php }?>
                                    </td>
                                    <td class="" style="width: 50px;"><a href="javascript:;" onclick="updateMenu(<?= $val['id']?>)">修改</a></td>
                                    <td class="" style="width: 110px;"><a href="javascript:;" onclick="addMenu(<?= $val['id']?>)">添加</a></td>
                                    <!--<td class="" style="width: 50px;"><a href="javascript:;" onclick="delMenu(<?/*= $val['id']*/?>)">X</td>-->
                                </tr>
                            <?php } ?>
                        <?php }else{?>
                            <tr><td colspan="8" style="text-align: center">暂无菜单！</td></tr>
                        <?php }?>
                        </tfoot>
                    </table>
                </div>
            </div>
        </div>
    
    </div>
    <div class="modal fade" id="menu-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title" id="myModalLabel">
                        添加菜单
                    </h4>
                </div>
                <div class="modal-body">
                    <form action="/sys-menu/add-menu" method="post" id="menu_form">
                        <div class="box-body">
                            <div class="form-group">
                                <label for="exampleInputPassword1">上级</label>
                                <select id="parent_id" name="parent_id" class="form-control" style="width: 50%;">
                                    <option value="0">一级菜单</option>
                                    <?php if(!empty($data_list)){?>
                                        <?php foreach($data_list as $value){?>
                                            <option value="<?= $value['id']?>"><?= $value['html']?><?= $value['name']?></option>
                                        <?php }?>
                                    <?php } ?>
                                </select>
                            </div>
    
                            <div class="form-group">
                                <label for="exampleInputEmail1">菜单名称</label>
                                <input type="text" class="form-control" name="name" id="name" placeholder="菜单名称">
                            </div>
    
                            <div class="form-group">
                                <label for="exampleInputEmail1">应用名称</label>
                                <input type="text" class="form-control" name="app" id="app" placeholder="应用名称">
                            </div>
    
                            <div class="form-group">
                                <label for="exampleInputEmail1">控制器</label>
                                <input type="text" class="form-control" name="model" id="model" placeholder="控制器">
                            </div>
    
                            <div class="form-group">
                                <label for="exampleInputEmail1">方法</label>
                                <input type="text" class="form-control" name="action" id="action" placeholder="方法">
                            </div>
    
                            <div class="form-group">
                                <label for="exampleInputEmail1">额外参数</label>
                                <input type="text" class="form-control" name="data" id="data" placeholder="额外参数">
                            </div>
    
                            <div class="form-group">
                                <label for="exampleInputEmail1">图标</label>
                                <input type="text" class="form-control" name="icon" id="icon" placeholder="图标">
                                <a href="https://adminlte.io/themes/AdminLTE/pages/UI/icons.html" target="_blank">Sample，只需COPY  fa-后面的内容</a>
                            </div>
    
                            <div class="form-group">
                                <label for="exampleInputPassword1">排序</label>
                                <input type="text" style="width: 50%;" name="sort" class="form-control" id="sort" placeholder="排序">
                            </div>
    
                            <div class="form-group">
                                <label for="exampleInputEmail1">状态</label>
                                <select id="status" name="status" class="form-control" style="width: 50%;">
                                    <option value="1">显示</option>
                                    <option value="0">不显示</option>
                                </select>
                            </div>
    
                            <div class="form-group">
                                <label for="exampleInputEmail1">类型</label>
                                <select id="type" name="type" class="form-control" style="width: 50%;">
                                    <option value="1">权限认证+菜单</option>
                                    <option value="0">只作为菜单</option>
                                </select>
                            </div>
    
                            <div class="form-group">
                                <label for="exampleInputPassword1">备注</label>
                                <textarea class="form-control" name="remark" id="remark" rows="3" placeholder="" ></textarea>
                            </div>
    
                        </div>
                        <!-- /.box-body -->
    
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                    </button>
                    <a type="button" class="btn btn-primary ajax_post_depart">
                        提交
                    </a>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>
    
    <div class="modal fade" id="menu-modal-update" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title" id="myModalLabel">
                        修改菜单
                    </h4>
                </div>
                <div class="modal-body">
                    <form action="/sys-menu/update-menu" method="post" id="menu_form_update">
                        <div class="box-body">
                            <div class="form-group">
                                <label for="exampleInputPassword1">上级</label>
                                <select id="parent_id_update" name="parent_id" class="form-control" style="width: 50%;">
                                    <option value="0">一级菜单</option>
                                    <?php if(!empty($data_list)){?>
                                        <?php foreach($data_list as $value){?>
                                            <option value="<?= $value['id']?>"><?= $value['html']?><?= $value['name']?></option>
                                        <?php }?>
                                    <?php } ?>
                                </select>
                            </div>
    
                            <div class="form-group">
                                <label for="exampleInputEmail1">菜单名称</label>
                                <input type="text" class="form-control" name="name" id="name_update" placeholder="菜单名称">
                            </div>
    
                            <div class="form-group">
                                <label for="exampleInputEmail1">应用名称</label>
                                <input type="text" class="form-control" name="app" id="app_update" placeholder="应用名称">
                            </div>
    
                            <div class="form-group">
                                <label for="exampleInputEmail1">控制器</label>
                                <input type="text" class="form-control" name="model" id="model_update" placeholder="控制器">
                            </div>
    
                            <div class="form-group">
                                <label for="exampleInputEmail1">方法</label>
                                <input type="text" class="form-control" name="action" id="action_update" placeholder="方法">
                            </div>
    
                            <div class="form-group">
                                <label for="exampleInputEmail1">额外参数</label>
                                <input type="text" class="form-control" name="data" id="data_update" placeholder="额外参数">
                            </div>
    
                            <div class="form-group">
                                <label for="exampleInputEmail1">图标</label>
                                <input type="text" class="form-control" name="icon" id="icon_update" placeholder="图标">
                                <a href="https://adminlte.io/themes/AdminLTE/pages/UI/icons.html" target="_blank">Sample，只需COPY  fa-后面的内容</a>
                            </div>
    
                            <div class="form-group">
                                <label for="exampleInputPassword1">排序</label>
                                <input type="text" style="width: 50%;" name="sort" class="form-control" id="sort_update" placeholder="排序">
                            </div>
    
                            <div class="form-group">
                                <label for="exampleInputEmail1">状态</label>
                                <select id="status_update" name="status" class="form-control" style="width: 50%;">
                                    <option value="1">显示</option>
                                    <option value="0">不显示</option>
                                </select>
                            </div>
    
                            <div class="form-group">
                                <label for="exampleInputEmail1">类型</label>
                                <select id="type_update" name="type" class="form-control" style="width: 50%;">
                                    <option value="1">权限认证+菜单</option>
                                    <option value="0">只作为菜单</option>
                                </select>
                            </div>
    
                            <div class="form-group">
                                <label for="exampleInputPassword1">备注</label>
                                <textarea class="form-control" name="remark" id="remark_update" rows="3" placeholder="" ></textarea>
                            </div>
                            <input type="hidden" style="width: 50%;" name="menu_id" class="form-control" id="menu_id" placeholder="">
                        </div>
                        <!-- /.box-body -->
    
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                    </button>
                    <a type="button" class="btn btn-primary ajax_post_update">
                        提交
                    </a>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>
</div>
<!-- 固定js -->
<script type="text/javascript" src="../static/plugins/jQuery/jquery-2.2.3.min.js"></script>
<script type="text/javascript" src="../static/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../static/plugins/datatables/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="../static/plugins/datatables/dataTables.bootstrap.min.js"></script>
<script type="text/javascript" src="../static/jBox/jquery.jBox-2.3.min.js"></script>
<script type="text/javascript" src="../static/jBox/i18n/jquery.jBox-zh-CN.js"></script>
<script type="text/javascript" src="../static/plugins/treeTable/jquery.treetable.js"></script>
<!-- 自定义js -->
<script type="text/javascript" src="/static/app/global.js?version=<?=Yii::$app->params['version']?>"></script>
<script type="text/javascript" src="../static/app/sys-menu/index.js?version=<?=Yii::$app->params['version']?>"></script>